#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<sys/ioctl.h>


int main(int argc, char *argv[])
{
    // printf("hello world\n");
    // return 0;
    char buf[128];
    int fd =  open("/dev/hello", O_RDWR);
    if(fd < 0)
    {
        perror("open");
        exit(1);
    }
    printf("open success\n");
    printf("fd = %d\n", fd);
    int ret = write(fd, "hello world", 11);
    if(ret < 0)
    {
        perror("write");
        exit(1);
    }
    printf("write success\n");
    ret = read(fd, buf, 128);
    if(ret < 0)
    {
        perror("read");
        exit(1);
    }
    printf("read success\n");
    printf("buf = %s\n", buf);

    sleep(10);

    close(fd);
    return 0;
}